package org.pork.service;

import java.util.ArrayList;
import java.util.List;

import javax.inject.Inject;

import org.pork.criteria.EmployeesCriteria;
import org.pork.domain.EmployeesVO;
import org.pork.mapper.EmployeesMapper;
import org.springframework.stereotype.Service;

@Service
public class EmployeesService implements EmployeesServiceInterface{
	
	@Inject
	EmployeesMapper emplyeesMapper;
	
	
	public void register(EmployeesVO eVO){
		
		try {
			emplyeesMapper.create(eVO);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}


	@Override
	public EmployeesVO view(String epId) {	
		
		EmployeesVO returnEVO = new EmployeesVO();
		
		try {
			
			returnEVO = emplyeesMapper.read(epId);
		
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		
		}
		
		return returnEVO;

	}


	@Override
	public void modify(EmployeesVO eVO) {
		
		try {
			
			emplyeesMapper.update(eVO);
			
		} catch (Exception e) {
			
			e.printStackTrace();
			
		}
		
		
	}


	@Override
	public void remove(String epId) {

		try {
			
			emplyeesMapper.delete(epId);
		
		} catch (Exception e) {
		
			e.printStackTrace();
			
		}
	
		
	}


	@Override
	public List<EmployeesVO> list(EmployeesCriteria eCri) throws Exception {

		List<EmployeesVO> listEVO = new ArrayList<EmployeesVO>();
		
		try{
			
			listEVO = emplyeesMapper.list(eCri);
			
		} catch (Exception e){
			
			e.printStackTrace();
			
		}
		
		return listEVO;
		
	}
	
	
	
	
}
